package cn.lwj.webService.entity;

public class JsonResult {

    public final static Integer SUCCESS = 200;
    public final static Integer ERROR = 500;
    public final static Integer OTHER = 201;

    private Integer status = 200;
    private String msg = "成功";
    private Object data;

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public JsonResult() {

    }

    public JsonResult(Object data) {
        this.data = data;
    }

    public JsonResult(Integer status, String msg, Object data) {
        this.status = status;
        this.msg = msg;
        this.data = data;
    }

    public static JsonResult responseData(Integer status, String msg, Object data) {
        JsonResult result = new JsonResult();
        result.status = status;
        result.msg = msg;
        result.data = data;
        return result;
    }

    public static String responseDataStr(Integer status, String msg, Object data) {
        JsonResult result = new JsonResult();
        result.status = status;
        result.msg = msg;
        result.data = data;
        return result.toString();
    }

    @Override
    public String toString() {
        return "Result{" +
                "status=" + status +
                ", msg='" + msg + '\'' +
                ", data=" + data +
                '}';
    }
}
